#ifndef _IM_SERVER_UID_SESSION_MAP_
#define _IM_SERVER_UID_SESSION_MAP_

#include <map>
#include <set>
#include <string>
#include <boost/thread.hpp>

#include "http_request.h"

namespace imserver {

class UidSessionMap {
 public:
  static UidSessionMap & Instance() {
    static UidSessionMap instance; 
    return instance;
  }
  void Add(int64_t uid, const std::string & session);
  int Remove(int64_t uid, const std::string & session);
  const std::set<std::string> & Get(int64_t uid) const;
  bool Contains(int64_t uid, const std::string & session) const;
  size_t size() const {
    return uid_sessions_.size();
  }
  void Dump() const;
 private:
  UidSessionMap() {}

  typedef std::map<int64_t, std::set<std::string> > MapType;
  MapType uid_sessions_;
};

}

#endif // _IM_SERVER_UID_SESSION_MAP_

